/**
 * @program: yygh_parent
 * @ClassName SmsController
 * @description:
 * @author: zyw
 * @create: 2023-06-01 13:35
 * @Version 1.0
 **/
package com.atguigu.yygh.sms.controller;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.sms.service.SmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user/sms")
@Api(value = "短信模块")
public class SmsController {
    @Autowired
    private SmsService smsService;

    @PostMapping("/send/{phone}")
    @ApiOperation(value = "进行短信验证")
    public R sendCode(@PathVariable String phone) {
        boolean flag = smsService.send(phone);
        if (flag) {
            return R.ok();
        } else {
            return R.error().message("发送短信失败！");
        }
    }
}
 
